package com.itheima.springbootrequestresponse.dao.impl;

import com.itheima.springbootrequestresponse.dao.EmpDao;
import com.itheima.springbootrequestresponse.pojo.Emp;
import com.itheima.springbootrequestresponse.util.XmlParserUtils;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * EmpDapImpl
 *
 * @author liliudong
 * @version 1.0
 * @description
 * @date 2023/7/7 17:08
 */
@Repository // 放进容器中 默认名称 empDapImpl
public class EmpDapImpl implements EmpDao {

    @Override
    public List<Emp> list() {
        // 拾取原始垃圾 - 垃圾桶
        String file = this.getClass().getClassLoader().getResource("emp.xml").getFile();
        // 思考？怎么从xml中获取数据（面向百度编程）
        List<Emp> empList = XmlParserUtils.parse(file, Emp.class);
        return empList;
    }
}
